/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * SES111E.java
 *
 * Created on 2011-7-6, 12:15:39
 */
package seso;

import java.awt.Graphics;
import org.jdesktop.application.Action;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import javax.swing.JOptionPane;
import javax.swing.JFileChooser;
import java.io.File;


/**
 *
 * @author Administrator
 */
public class SES111E extends MaintDialog {

    String transactionNo = "";
    //etcohQuery.setParameter("transactionNo", transactionNo);

    /** Creates new form SES111E */
    public SES111E(javax.swing.JFrame parent, boolean modal) {
        super(parent, modal);
        moreConstructon();
    }

    public SES111E(javax.swing.JFrame parent, boolean modal, String transactionNo, int dlgDataMode) {
        super(parent, modal);
        this.transactionNo = transactionNo;
        this.dlgDataMode = dlgDataMode;

        moreConstructon();
    }

    public void moreConstructon() {
        initComponents();
        isBrowseDialog = false;
        refreshToolsBar();

        masterJScrollPane.setVisible(false);

        masterTable.setRowSelectionInterval(0, 0);

        setProgTitle("SES100/E*", "Upload Customer Order");
        this.IncreaseIndexMiniProgID = false;
        fldTransactionNo.setEditable(false);
    }

    @Override
    public void paint(Graphics g) {
        MoreSetControlsLocationAndSize();

        super.paint(g);
    }

    private void MoreSetControlsLocationAndSize() {

        int width = getWidth(), height = getHeight();

        rDlgDataAeraJPanel.setSize(width, height - 90); //  ToolsBar and StatusBar total margin

        bottomNavJPanel.setLocation(10, rDlgDataAeraJPanel.getHeight() - 10 - bottomNavJPanel.getHeight());
        bottomNavJPanel.setSize(rDlgDataAeraJPanel.getWidth() - bottomNavJPanel.getX() * 2, bottomNavJPanel.getHeight());

        comNavClose.setLocation(0, 0);
        comNavNext.setLocation(bottomNavJPanel.getWidth() - comNavNext.getWidth(), 0);
        comNavPrev.setLocation(comNavNext.getX() - comNavPrev.getWidth(), 0);

        headerPanelBG.setSize(rDlgDataAeraJPanel.getWidth() - headerPanelBG.getX() * 2, headerPanelBG.getHeight());
        detailPanelBG.setSize(headerPanelBG.getWidth(), rDlgDataAeraJPanel.getHeight() - bottomNavJPanel.getHeight() - detailPanelBG.getY() - 10);
        
        selectOrderFileDirRButton.setEnabled(dlgDataMode != AppSetting.DISPLAY_MODE);
        uploadOrderTextFileRButton.setEnabled(dlgDataMode == AppSetting.DISPLAY_MODE);
        notifyRButton.setEnabled(dlgDataMode == AppSetting.DISPLAY_MODE);

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("M3G;databaseName=M3ERPPU").createEntityManager();
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(seso.SesoApp.class).getContext().getResourceMap(SES111E.class);
        etcohQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery(resourceMap.getString("etcohQuery.query")); // NOI18N
        etcohList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(etcohQuery.getResultList());
        rDlgDataAeraJPanel = new seso.RDialogDataAeraPanel();
        dLabel1 = new seso.RLabel();
        dLabel2 = new seso.RLabel();
        dLabel3 = new seso.RLabel();
        dLabel4 = new seso.RLabel();
        dLabel5 = new seso.RLabel();
        dLabel6 = new seso.RLabel();
        dLabel8 = new seso.RLabel();
        dLabel7 = new seso.RLabel();
        fldTransactionNo = new seso.RTextField();
        fldStatus = new seso.RTextField();
        dTextField3 = new seso.RTextField();
        dTextField4 = new seso.RTextField();
        dTextField5 = new seso.RTextField();
        dTextField6 = new seso.RTextField();
        fldCreateDate = new seso.RTextField();
        fldOrderFileDirectory = new seso.RTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        selectOrderFileDirRButton = new seso.RBgButton();
        uploadOrderTextFileRButton = new seso.RBgButton();
        notifyRButton = new seso.RBgButton();
        bottomNavJPanel = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        comNavClose = new javax.swing.JButton();
        comNavNext = new javax.swing.JButton();
        comNavPrev = new javax.swing.JButton();
        masterJScrollPane = new javax.swing.JScrollPane();
        masterTable = new javax.swing.JTable();
        headerPanelBG = new seso.PanelBGSize1();
        detailPanelBG = new seso.PanelBGSize4();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N
        getContentPane().setLayout(null);

        rDlgDataAeraJPanel.setName("rDlgDataAeraJPanel"); // NOI18N
        rDlgDataAeraJPanel.setLayout(null);

        dLabel1.setText(resourceMap.getString("dLabel1.text")); // NOI18N
        dLabel1.setName("dLabel1"); // NOI18N
        rDlgDataAeraJPanel.add(dLabel1);
        dLabel1.setBounds(400, 50, 60, 20);

        dLabel2.setText(resourceMap.getString("dLabel2.text")); // NOI18N
        dLabel2.setName("dLabel2"); // NOI18N
        rDlgDataAeraJPanel.add(dLabel2);
        dLabel2.setBounds(20, 130, 90, 20);

        dLabel3.setText(resourceMap.getString("dLabel3.text")); // NOI18N
        dLabel3.setName("dLabel3"); // NOI18N
        rDlgDataAeraJPanel.add(dLabel3);
        dLabel3.setBounds(20, 160, 90, 20);

        dLabel4.setText(resourceMap.getString("dLabel4.text")); // NOI18N
        dLabel4.setName("dLabel4"); // NOI18N
        rDlgDataAeraJPanel.add(dLabel4);
        dLabel4.setBounds(20, 190, 90, 20);

        dLabel5.setText(resourceMap.getString("dLabel5.text")); // NOI18N
        dLabel5.setName("dLabel5"); // NOI18N
        rDlgDataAeraJPanel.add(dLabel5);
        dLabel5.setBounds(20, 220, 90, 20);

        dLabel6.setText(resourceMap.getString("dLabel6.text")); // NOI18N
        dLabel6.setName("dLabel6"); // NOI18N
        rDlgDataAeraJPanel.add(dLabel6);
        dLabel6.setBounds(20, 250, 90, 20);

        dLabel8.setText(resourceMap.getString("dLabel8.text")); // NOI18N
        dLabel8.setName("dLabel8"); // NOI18N
        rDlgDataAeraJPanel.add(dLabel8);
        dLabel8.setBounds(20, 280, 120, 20);

        dLabel7.setText(resourceMap.getString("dLabel7.text")); // NOI18N
        dLabel7.setName("dLabel7"); // NOI18N
        rDlgDataAeraJPanel.add(dLabel7);
        dLabel7.setBounds(20, 50, 90, 20);

        fldTransactionNo.setEditable(false);
        fldTransactionNo.setCustomizeEditable(false);
        fldTransactionNo.setName("fldTransactionNo"); // NOI18N

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.transactionNo}"), fldTransactionNo, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        rDlgDataAeraJPanel.add(fldTransactionNo);
        fldTransactionNo.setBounds(150, 50, 150, 24);

        fldStatus.setCustomizeEditable(false);
        fldStatus.setName("fldStatus"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.status}"), fldStatus, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        rDlgDataAeraJPanel.add(fldStatus);
        fldStatus.setBounds(460, 50, 130, 24);

        dTextField3.setEditable(false);
        dTextField3.setName("dTextField3"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.season}"), dTextField3, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        rDlgDataAeraJPanel.add(dTextField3);
        dTextField3.setBounds(150, 130, 100, 24);

        dTextField4.setName("dTextField4"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.weeklyOrFinal}"), dTextField4, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        rDlgDataAeraJPanel.add(dTextField4);
        dTextField4.setBounds(150, 160, 100, 24);

        dTextField5.setName("dTextField5"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.brandList}"), dTextField5, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        rDlgDataAeraJPanel.add(dTextField5);
        dTextField5.setBounds(150, 190, 150, 24);

        dTextField6.setName("dTextField6"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.description}"), dTextField6, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        rDlgDataAeraJPanel.add(dTextField6);
        dTextField6.setBounds(150, 220, 300, 24);

        fldCreateDate.setName("fldCreateDate"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.createDate}"), fldCreateDate, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        rDlgDataAeraJPanel.add(fldCreateDate);
        fldCreateDate.setBounds(150, 250, 100, 24);

        fldOrderFileDirectory.setName("fldOrderFileDirectory"); // NOI18N

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.filePath}"), fldOrderFileDirectory, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        rDlgDataAeraJPanel.add(fldOrderFileDirectory);
        fldOrderFileDirectory.setBounds(150, 280, 390, 24);

        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setForeground(resourceMap.getColor("jLabel1.foreground")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N
        jLabel1.setRequestFocusEnabled(false);
        rDlgDataAeraJPanel.add(jLabel1);
        jLabel1.setBounds(20, 10, 120, 15);

        jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
        jLabel2.setForeground(resourceMap.getColor("jLabel2.foreground")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N
        rDlgDataAeraJPanel.add(jLabel2);
        jLabel2.setBounds(20, 80, 140, 15);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(seso.SesoApp.class).getContext().getActionMap(SES111E.class, this);
        selectOrderFileDirRButton.setAction(actionMap.get("selectOrderFileDirAction")); // NOI18N
        selectOrderFileDirRButton.setText(resourceMap.getString("selectOrderFileDirRButton.text")); // NOI18N
        selectOrderFileDirRButton.setFocusable(false);
        selectOrderFileDirRButton.setName("selectOrderFileDirRButton"); // NOI18N
        rDlgDataAeraJPanel.add(selectOrderFileDirRButton);
        selectOrderFileDirRButton.setBounds(150, 305, 70, 28);

        uploadOrderTextFileRButton.setAction(actionMap.get("uploadOrderTextFileAction")); // NOI18N
        uploadOrderTextFileRButton.setText(resourceMap.getString("uploadOrderTextFileRButton.text")); // NOI18N
        uploadOrderTextFileRButton.setFocusable(false);
        uploadOrderTextFileRButton.setName("uploadOrderTextFileRButton"); // NOI18N
        rDlgDataAeraJPanel.add(uploadOrderTextFileRButton);
        uploadOrderTextFileRButton.setBounds(240, 305, 140, 28);

        notifyRButton.setAction(actionMap.get("notifyAction")); // NOI18N
        notifyRButton.setText(resourceMap.getString("notifyRButton.text")); // NOI18N
        notifyRButton.setFocusable(false);
        notifyRButton.setName("notifyRButton"); // NOI18N
        rDlgDataAeraJPanel.add(notifyRButton);
        notifyRButton.setBounds(450, 305, 90, 28);

        bottomNavJPanel.setName("bottomNavJPanel"); // NOI18N
        bottomNavJPanel.setOpaque(false);
        bottomNavJPanel.setLayout(null);

        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        bottomNavJPanel.add(jButton1);
        jButton1.setBounds(290, 50, 83, 25);

        comNavClose.setAction(actionMap.get("cmdCloseAction")); // NOI18N
        comNavClose.setIcon(resourceMap.getIcon("comNavClose.icon")); // NOI18N
        comNavClose.setBorder(null);
        comNavClose.setBorderPainted(false);
        comNavClose.setContentAreaFilled(false);
        comNavClose.setFocusPainted(false);
        comNavClose.setFocusable(false);
        comNavClose.setName("comNavClose"); // NOI18N
        comNavClose.setPressedIcon(resourceMap.getIcon("comNavClose.pressedIcon")); // NOI18N
        comNavClose.setRolloverIcon(resourceMap.getIcon("comNavClose.rolloverIcon")); // NOI18N
        bottomNavJPanel.add(comNavClose);
        comNavClose.setBounds(0, 0, 88, 28);

        comNavNext.setAction(actionMap.get("comNavNextAction")); // NOI18N
        comNavNext.setIcon(resourceMap.getIcon("comNavNext.icon")); // NOI18N
        comNavNext.setBorder(null);
        comNavNext.setBorderPainted(false);
        comNavNext.setContentAreaFilled(false);
        comNavNext.setFocusPainted(false);
        comNavNext.setFocusable(false);
        comNavNext.setName("comNavNext"); // NOI18N
        comNavNext.setPressedIcon(resourceMap.getIcon("comNavNext.pressedIcon")); // NOI18N
        comNavNext.setRolloverIcon(resourceMap.getIcon("comNavNext.rolloverIcon")); // NOI18N
        bottomNavJPanel.add(comNavNext);
        comNavNext.setBounds(587, 0, 88, 28);

        comNavPrev.setAction(actionMap.get("comNavPrevAction")); // NOI18N
        comNavPrev.setIcon(resourceMap.getIcon("comNavPrev.icon")); // NOI18N
        comNavPrev.setBorder(null);
        comNavPrev.setBorderPainted(false);
        comNavPrev.setContentAreaFilled(false);
        comNavPrev.setFocusPainted(false);
        comNavPrev.setFocusable(false);
        comNavPrev.setName("comNavPrev"); // NOI18N
        comNavPrev.setPressedIcon(resourceMap.getIcon("comNavPrev.pressedIcon")); // NOI18N
        comNavPrev.setRolloverIcon(resourceMap.getIcon("comNavPrev.rolloverIcon")); // NOI18N
        bottomNavJPanel.add(comNavPrev);
        comNavPrev.setBounds(530, 0, 54, 28);

        rDlgDataAeraJPanel.add(bottomNavJPanel);
        bottomNavJPanel.setBounds(10, 350, 670, 28);

        masterJScrollPane.setFocusable(false);
        masterJScrollPane.setName("masterJScrollPane"); // NOI18N

        masterTable.setName("masterTable"); // NOI18N

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, etcohList, masterTable);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${transactionNo}"));
        columnBinding.setColumnName("Transaction No");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${createDate}"));
        columnBinding.setColumnName("Create Date");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${filePath}"));
        columnBinding.setColumnName("File Path");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${description}"));
        columnBinding.setColumnName("Description");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${status}"));
        columnBinding.setColumnName("Status");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${brandList}"));
        columnBinding.setColumnName("Brand List");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${weeklyOrFinal}"));
        columnBinding.setColumnName("Weekly Or Final");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${season}"));
        columnBinding.setColumnName("Season");
        columnBinding.setColumnClass(String.class);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        masterJScrollPane.setViewportView(masterTable);
        masterTable.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("masterTable.columnModel.title0")); // NOI18N
        masterTable.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("masterTable.columnModel.title1")); // NOI18N
        masterTable.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("masterTable.columnModel.title2")); // NOI18N
        masterTable.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("masterTable.columnModel.title3")); // NOI18N
        masterTable.getColumnModel().getColumn(4).setHeaderValue(resourceMap.getString("masterTable.columnModel.title4")); // NOI18N
        masterTable.getColumnModel().getColumn(5).setHeaderValue(resourceMap.getString("masterTable.columnModel.title5")); // NOI18N
        masterTable.getColumnModel().getColumn(6).setHeaderValue(resourceMap.getString("masterTable.columnModel.title6")); // NOI18N
        masterTable.getColumnModel().getColumn(7).setHeaderValue(resourceMap.getString("masterTable.columnModel.title7")); // NOI18N

        rDlgDataAeraJPanel.add(masterJScrollPane);
        masterJScrollPane.setBounds(330, 200, 390, 100);

        headerPanelBG.setText(resourceMap.getString("headerPanelBG.text")); // NOI18N
        headerPanelBG.setName("headerPanelBG"); // NOI18N
        rDlgDataAeraJPanel.add(headerPanelBG);
        headerPanelBG.setBounds(10, 30, 740, 48);

        detailPanelBG.setText(resourceMap.getString("detailPanelBG.text")); // NOI18N
        detailPanelBG.setName("detailPanelBG"); // NOI18N
        rDlgDataAeraJPanel.add(detailPanelBG);
        detailPanelBG.setBounds(10, 100, 300, 40);

        getContentPane().add(rDlgDataAeraJPanel);
        rDlgDataAeraJPanel.setBounds(0, 70, 970, 390);

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                SES111E dialog = new SES111E(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    @Action
    public void comNavPrevAction() {
        if (prevDialog == null) {
            this.cmdCloseAction();
        } else {

            dispose();
            prevDialog.setVisible(true);
            ((MaintDialog) prevDialog).replaceMiniProg();
        }
    }

    @Action
    public void comNavNextAction() {
        cmdSave(true);
    }

    private void cmdSave(boolean showMessage) {
        entityManager.getTransaction().begin();
        for (int i = 0; i < etcohList.size(); i++) {
            entityManager.persist(etcohList.get(i));
        }
        entityManager.getTransaction().commit();
        
        if (showMessage) {
            JOptionPane.showMessageDialog(null, "Data Saved");
        }
    }


    @Action
    public void selectOrderFileDirAction() {
        JFileChooser fc = new JFileChooser();
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        fc.setDialogTitle("Select a dictory");
        int result = fc.showOpenDialog(null);
        if (result == JFileChooser.APPROVE_OPTION) {
            String path = fc.getSelectedFile().getAbsolutePath();
            fldOrderFileDirectory.setText(path);
        }
    }

    @Action
    public void uploadOrderTextFileAction() {

        String transactionNo = fldTransactionNo.getText().trim();
        
        if (transactionNo.isEmpty()) {
            return;
        }
        
        if (!(new File(fldOrderFileDirectory.getText().trim())).exists()) {
            JOptionPane.showMessageDialog(null, "Directory NOT exist");
            return;
        }
        
        
        String cmd = "D:\\sesotask\\importtxtco.exe " + transactionNo;
        Runtime rn = Runtime.getRuntime();
        Process process = null;
        try {
            process = rn.exec(cmd);
        } catch (Exception ignore) {
            return;
        }
        
        fldStatus.setText("Uploaded");
        cmdSave(false);
       
        JOptionPane.showMessageDialog(null, "Uploaded");
    }

    @Action
    public void notifyAction() {
        fldStatus.setText("Notify");
        cmdSave(false);
       
        JOptionPane.showMessageDialog(null, "Notified"); 
    }
    
    

    @Override
    public void cmdRefreshAction() {
        super.cmdRefreshAction();
        java.util.Collection data = etcohQuery.getResultList();
        for (Object entity : data) {
            entityManager.refresh(entity);
        }
        etcohList.clear();
        etcohList.addAll(data);
        
        //masterTable.repaint();
        masterTable.setRowSelectionInterval(0, 0);
    }


    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel bottomNavJPanel;
    private javax.swing.JButton comNavClose;
    private javax.swing.JButton comNavNext;
    private javax.swing.JButton comNavPrev;
    private seso.RLabel dLabel1;
    private seso.RLabel dLabel2;
    private seso.RLabel dLabel3;
    private seso.RLabel dLabel4;
    private seso.RLabel dLabel5;
    private seso.RLabel dLabel6;
    private seso.RLabel dLabel7;
    private seso.RLabel dLabel8;
    private seso.RTextField dTextField3;
    private seso.RTextField dTextField4;
    private seso.RTextField dTextField5;
    private seso.RTextField dTextField6;
    private seso.PanelBGSize4 detailPanelBG;
    private javax.persistence.EntityManager entityManager;
    private java.util.List<seso.Etcoh> etcohList;
    private javax.persistence.Query etcohQuery;
    private seso.RTextField fldCreateDate;
    private seso.RTextField fldOrderFileDirectory;
    private seso.RTextField fldStatus;
    private seso.RTextField fldTransactionNo;
    private seso.PanelBGSize1 headerPanelBG;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane masterJScrollPane;
    private javax.swing.JTable masterTable;
    private seso.RBgButton notifyRButton;
    private seso.RDialogDataAeraPanel rDlgDataAeraJPanel;
    private seso.RBgButton selectOrderFileDirRButton;
    private seso.RBgButton uploadOrderTextFileRButton;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}
